<template>
  <div>
    <el-table :data="userList" border style="width: 100%">
      <el-table-column prop="id" label="编号" />
      <el-table-column prop="name" label="资源名称" />
      <el-table-column prop="url" label="资源路径" />
      <el-table-column prop="description" label="描述" />
      <el-table-column prop="address" label="添加时间">
        <template #default="{ row }">
          {{ dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页器 -->
    <el-pagination
      v-model:current-page="paginationParams.currentPage4"
      v-model:page-size="paginationParams.pageSize4"
      :page-sizes="[10, 20, 50, 100]"
      layout="total, sizes, prev, pager, next, jumper"
      :background="true"
      :total="paginationParams.total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script lang="ts" setup>
import dayjs from "dayjs";
import { useTableFn } from "@/hooks/component/useTable";
import { reactive } from "vue";
import * as http from "./api/http";
// 列表数据/分页器
let { userList, paginationParams, handleSizeChange, handleCurrentChange } =
  useTableFn(http.resource.ResourceList,{});
</script>

<style lang="less" scoped>
:deep(.el-pagination) {
  float: right;
}
</style>
